package com.tanhua.admin.controller;

import com.tanhua.admin.service.DashboardService;
import com.tanhua.model.vo.UsersDataVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/dashboard")
public class dashboardController {
    @Autowired
    private DashboardService dashboardService;
    /**
     * 新增、活跃用户、次日留存率
     * @return
     */
    @GetMapping("/users")
    public UsersDataVo users(@RequestParam("sd") String sd,
                             @RequestParam("ed") String ed,
                             @RequestParam("type") String type){
        return dashboardService.users(sd,type,ed);

    }



    /**
     * 统计概要
     */
    @GetMapping("/summary")
    public ResponseEntity  summary(){
        //调用service查询统计
        Map map=dashboardService.summary();
        return ResponseEntity.ok(map);
    }
}